package com.example.smartcitydemo.ui.person

import android.os.Bundle
import androidx.fragment.app.Fragment
import com.example.smartcitydemo.R
import com.example.smartcitydemo.base.BaseFragment
import com.example.smartcitydemo.databinding.FragmentBusOrderBinding
import com.example.smartcitydemo.ext.init

/**
 * @PACKAGE_NAME: com.example.smartcitydemo.ui.person
 * @NAME: Caleb.F
 * @DATE: 2021/11/11 14:13
 * @Email: 1919796283@qq.com
 */
class BusOrderFragment : BaseFragment<FragmentBusOrderBinding>(R.layout.fragment_bus_order) {
    private val myViewPager2Adapter: MyBusOderPager2Adapter by lazy(LazyThreadSafetyMode.SYNCHRONIZED)
    {
        val list: MutableList<Fragment> = mutableListOf()
        list.run {
            val instance = BusOrderDetailFragment.getInstance(0)
            val instance1 = BusOrderDetailFragment.getInstance(1)
            add(instance)
            add(instance1)
        }
        MyBusOderPager2Adapter(this@BusOrderFragment, list)
    }

    override fun initData() {
    }

    override fun initView(bindView: FragmentBusOrderBinding, savedInstanceState: Bundle?) {
        val list = listOf("已完成", "未完成")
        bindView.run {
            busOrderToolBar.tvContent.text = "订单查询"
            pager2BusOrder.init(myViewPager2Adapter, tabBusOrder) { tab, pos ->
                tab.text = list[pos]
            }
        }
    }

    override fun addObservers(bindView: FragmentBusOrderBinding) {

    }

}